<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Ideas.IdeaDetailViewModel>" %>

<%@ Import Namespace="Stimulus360.Models.Data.CustomTypes" %>
<%@ Import Namespace="Stimulus360.Controllers" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Stimulus360.Models.Data" %>
<%@ Import Namespace="Stimulus360.Services" %>
<asp:Content ID="IdeaDetails" ContentPlaceHolderID="MainContent" runat="server">
    <%
        Idea idea = Model.Idea;
        RatingViewModel ratingViewModel = new RatingViewModel { Id = idea.IdeaId, AverageRating = idea.AverageRating.GetValueOrDefault(0), IsDisabled = true, IdeaId = idea.IdeaId };
    %>
    <!-- Left Col Start -->
    <%Html.RenderPartial("IdeaDetailLeftNavigation", idea.IdeaId ); %>
    <!-- Left Col Ends -->
    <!-- Main Area Start -->
    <div class="mainInner colViewHdr">
        <div class="ideaListItem p10">
            <h1 class="floatLeft">
                <%= Html.Encode(idea.Title) %></h1>
            <div class="floatRight">
                <a href="/Ideas/<%=idea.IdeaId%>/Feedback/Submit" class="headerLabelBtn">
                <span>Submit Feedback</span></a>
            </div>
            <br clear="all" />
            <div class="ideaStatusBar">
                <div class="floatLeft pr10">
                    <%=idea.DateSubmitted.ToString("D",CultureInfo.CreateSpecificCulture("en-US"))  %>|
                    by <%=idea.SubmittedBy %></div>
                <div class="ideaStatus">
                    <div>
                        <%Html.RenderPartial("Rating", ratingViewModel); %></div>
                    <div class="separator" style="line-height: 18px;">
                        (<%=idea.UserRatingsCount ?? 0 %>)</div>
                    <div class="separator pt02">
                        Favorites
                        <%=idea.FavoritesCount ?? 0%></div>
                    <div class="separatorFav pt02">
                        <div class="facebook" title="Facebook"><%=Html.Image("facebook_logo.png", "Facebook")%></div>
                        <div class="twitter" title="Twitter"><%=Html.Image("twitter logo.png", "Twitter")%></div>
                        <div class="digg" title="Digg"><%=Html.Image("digg.png", "Digg") %></div>
                    </div>
                </div>
            </div>
            <div class="ideaStatusRpt">
                <div style="margin-bottom:5px;">
                    <h4>Status:</h4>
                    <div><%= Html.Image(idea.StatusString.ToLower() + ".png", idea.StatusString)%></div>
                    <div class="pb5"><%=idea.StatusString%></div>
                </div>
                <br clear="all"/>
                <div style="margin-bottom:5px;">
                    <h4>Category:</h4>
                    <div><%=idea.InvestmentCategory.Category%></div>
                </div>
                <br clear="all"/>
                <div id="ProjectLink" style="display: none">
                    <b>Project:</b>
                    <% if (Model.IdeaProjectList != null)
                       {
                           foreach (ProjectSummary summary in Model.IdeaProjectList)
                           { %>
                      <%--<a href="#">
                        <%=summary.ProjectTitle%>--%>
                         <%= Html.ActionLink( Html.Encode(summary.ProjectTitle), "Details","Projects", new { projectId = summary.ProjectId},null)%>
                        &nbsp;<%--</a>--%>
                    <%--<%= summary.ProjectTitle %>--%>
                    <% }
                       }%>
                </div>
                <div id="FailureReason" style="display: none">
                    <p><b>Reason:</b><%= Html.Encode(idea.Comments)%></p>
                </div>
            </div>
            <br clear="all" />
            <br clear="all" />
            <h2>
                Description:</h2>
            <p class="ideaDetail">
                <%= Html.Encode(idea.Description)%></p>
            <br />
        </div>
        <br clear="all" />
        <!-- Related Ideas Start -->
        <div id="relatedIdeasContainer">
            <%Html.RenderPartial("RelatedIdeas", Model.RelatedIdeas); %>
        </div>
        <!-- Related Ideas End -->
    </div>
    <!-- Main Area End -->
    
    <!-- Popup div for showing not service not available message -->
    <div id="windowElementDemo" class="myOwnStuff" style="display: none;">
        <div class="jqalert-container">
            <div class="jqalert">
                <div class="jqalert-title" style="background-color: Blue; color: White;"></div>
                <div class="jqalert-icon"></div>
                <div class="jqalert-message"></div>
                <div class="jqalert-buttons">
                    <button onclick="window.jqalerter.closeVirtualWindow(this.parentNode.parentNode.parentNode);">OK</button>
                </div>
            </div>
        </div>
    </div>
    <!-- Popup div end -->
    <script type="text/javascript" language="javascript">

        $(document).ready(function() {
        $("#summaryTag").addClass("selected");

            var status = "<%=Model.Idea.StatusString%>";
            if (status == "Accepted") {
                $("#ProjectLink").show();
            }

            if ((status == "Rejected") || (status == "Postponed")) {
                $("#FailureReason").show();

            }

        });
    </script>

</asp:Content>
